<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>学IT - 后台管理系统</title>
    <?php include "/views/public/css.html"?>
</head>

<body>

    <!-- 侧边栏 -->
    <?php include "/views/public/aside.html"?>
    <!-- 主体 -->
    <div class="main">
        <div class="container-fluid">
            <!-- 头部 -->
            <?php include "/views/public/header.html"?>
            <!-- 讲师列表 -->
            <div class="body teacher-list">
                <!-- 面包屑 -->
                <ol class="breadcrumb">
                    <li><a href="javascript:;">讲师管理</a></li>
                    <li class="active">讲师列表</li>
                </ol>
                <div class="page-title">
                    <a href="/teacher/manage" class="btn btn-success btn-sm pull-right">添加讲师</a>
                </div>
                <div class="panel panel-default">
                    <div class="panel-body">
                        <form action="" class="form-inline">
                            <div class="input-group">
                                <input type="text" class="form-control input-sm">
                                <span class="input-group-btn">
                                    <button class="btn btn-success btn-sm">搜索</button>
                                </span>
                            </div>
                        </form>
                    </div>
                    <table class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr>
                                <th>编号</th>
                                <th>姓名</th>
                                <th>昵称</th>
                                <th>年龄</th>
                                <th>性别</th>
                                <th>手机号码</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody id="teacher-list">
                            <!-- 挖个坑 -->
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <!-- 模态框 查看讲师信息 -->
    <div class="modal fade" id="teacherModal">
        <div class="modal-dialog" style="width: 750px;">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="panel-title">讲师信息</h4>
                </div>
                <div class="panel-body">
                    <table class="table table-bordered table-condensed">
                        <tbody id="teacher-info">
                            <!-- 挖个坑 -->
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <script type="text/template" id="teacher-info-tpl">
        <tr>
            <th>姓名:</th>
            <td>{{tc_name}}</td>
            <th>职位:</th>
            <td colspan="3">讲师</td>
            <td rowspan="4" width="128">
                <div class="avatar">
                    {{if !tc_avatar}}
                    <img src="/views/static/images/default.png" alt="">
                    {{else}}
                    <img src="{{tc_avatar}}" alt="">
                    {{/if}}
                </div>
            </td>
        </tr>
        <tr>
            <th>花名:</th>
            <td>{{tc_roster}}</td>
            <th>出生日期:</th>
            <td colspan="3">{{tc_birthday}}</td>
        </tr>
        <tr>
            <th>性别:</th>
            <td>{{tc_gender == "0"? "男": "女"}}</td>
            <th>入职日期:</th>
            <td colspan="3">{{tc_join_date}}</td>
        </tr>
        <tr>
            <th>手机号码:</th>
            <td colspan="2">{{tc_cellphone}}</td>
            <th>邮箱:</th>
            <td colspan="2">{{tc_email}}</td>
        </tr>
        <tr>
            <th>籍贯:</th>
            <td colspan="6">{{tc_hometown.split("|").join(" ")}}</td>
            <!-- <td colspan="6">{{tc_hometown.replace(/\|/g, " ")}}</td> -->
        </tr>
        <tr>
            <td colspan="7">
                <div class="introduce">
                    {{@tc_introduce||""}}
                </div>
            </td>
        </tr>
    </script>

    <script type="text/template" id="teacher-list-tpl">
        {{each result v i}}
        <tr>
            <td>{{i + 1}}</td>
            <td>{{v.tc_name}}</td>
            <td>{{v.tc_roster}}</td>
            <td>{{v.tc_birthday | getage}}</td>
            <td>{{v.tc_gender == "0" ? "男" : "女"}}</td>
            <td>{{v.tc_cellphone}}</td>
            <td data-id="{{v.tc_id}}">
                <a href="#" class="btn btn-info btn-xs btn-checkinfo">查 看</a>
                <a href="/teacher/manage?id={{v.tc_id}}" class="btn btn-info btn-xs">编 辑</a>
                <a href="javascript:;" data-status="{{v.tc_status}}" class="btn {{v.tc_status == "0" ? "btn-warning" : "btn-success"}} btn-xs btn-status">{{v.tc_status == "0" ? "注 销" : "启 用"}}</a>
            </td>
        </tr>
        {{/each}}
    </script>

    <?php include "/views/public/js.html"?>

    <script>
        //baseUrl: /views/assets
        require(["../static/js/teacher/list"])
    </script>
</body>

</html>